import request from '../utils/request'

// 获取所有咨询师列表
export const getAllDoctors = () => {
  return request({
    url: '/doctor/list',
    method: 'get'
  })
}

// 根据条件筛选咨询师
export const filterDoctors = (params: {
  name?: string
  sex?: number
  skill?: string
}) => {
  return request({
    url: '/doctor/filter',
    method: 'get',
    params
  })
}

// 获取咨询师详细信息
export const getDoctorDetail = (doctorId: number) => {
  return request({
    url: `/doctor/${doctorId}`,
    method: 'get'
  })
}

// 获取咨询师可预约时间段
export const getDoctorSchedule = (doctorId: number) => {
  return request({
    url: '/timelist/get',
    method: 'get',
    params: { doctorId }
  })
}

// 创建预约
export const createAppointment = (data: {
  clientId: number
  doctorId: number
  timelistId: number
}) => {
  return request({
    url: '/appointment/create',
    method: 'post',
    params: data
  })
}
